package com.example.uit_management;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.content.Context;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RadioButton;
import android.widget.TextView;

public class ArrayAdapter_registry_dialog extends BaseAdapter {
	// XML node keys
	RadioButton check_checkbox_registry ; 
    TextView subjectName_checkbox_registry;            
    private Activity activity;
    private String data_String;
    private String data_index;
    private static LayoutInflater inflater=null;   
    
    public ArrayAdapter_registry_dialog(Activity a,String data_s,String data_i) {    	
        activity = a;        
        data_String = data_s;
        data_index= data_i;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }   
    public int getCount() {
        return data_String.split("_").length;
    }
    public int getCount_Index() {
        return data_index.split("_").length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "Vao adapter");

        if(convertView==null)
            vi = inflater.inflate(R.layout.listcheckbox_registry_row, null);
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "1");
        // Get id of row
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "2");
        check_checkbox_registry = (RadioButton)vi.findViewById(R.id.check_checkbox_registry); 
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "3");
        subjectName_checkbox_registry = (TextView)vi.findViewById(R.id.subjectName_checkbox_registry);        
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "4");
        String data_s= new String();
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "5 :"+position);
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "data String :"+data_String);
        data_s = data_String.split("-")[position];        
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "6");
        //-- Set Ten mon hoc thuc hanh
        subjectName_checkbox_registry.setText(data_s);
        Log.e(ArrayAdapter_registry_dialog.class.toString(),  "7");    
        return vi;        
    }	
}
